package com.lagou.springbootframework;

import org.apache.catalina.startup.Tomcat;

/**
 * 自定义springboot启动类
 */
public class SpringApplication {


    public static void run() {
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8081);
        try {
            //设置文件路径,相当于开启了一部分自动配置，contextPath访问路径，docBase指的资源路径
            tomcat.addWebapp("/", "D:\\");
            tomcat.start();
            System.out.println("tomcat已启动");
            tomcat.getServer().await();
        }catch (Exception e){
            e.printStackTrace();
        }

    }

}
